package Offer.offer2016;

public class Test47 
{

	public static void main(String[] args) 
	{
		System.out.println(add(0, 6)); 

	}
    public static int add(int num1, int num2)
    {
    	int sum;
    	int carry;
    	do 
    	{
		  sum = num1^num2;
		  carry=(num1&num2)<<1;
		  num1=sum;
		  num2=carry;
				  
		} while (num2!=0);
        return num1;
    }
    
}
